package com.bwie.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bwie.utils.R;
import com.bwie.vo.PageInfoVo;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bwie.mapper.LibraryMapper;
import com.bwie.domain.Library;
import com.bwie.service.LibraryService;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional(rollbackFor = Exception.class)
public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> implements LibraryService{

    @Autowired
    private LibraryMapper libraryMapper;
    @Override
    public R getLibraryList(PageInfoVo pageInfoVo) {
        //构建分页对象
        Page<Library> libraryPage = new Page<>(pageInfoVo.getPageNum(), pageInfoVo.getPageSize());
        IPage<Library> libraryIPage = libraryMapper.getLibraryList(libraryPage,pageInfoVo);
        //返回响应结果
        return R.OK(libraryIPage);
    }
}
